﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace FinWeb3.Models
{
    public class ComparationBill
    {
        public int OriginalId { get; set; }
        public int? OriginalBankId { get; set; }
        public int? CurrentBankId { get; set; }
        public DateTime OriginalDay { get; set; }
        public DateTime CurrentDay { get; set; }
        public string OriginalDescription { get; set; }
        public string CurrentDescription { get; set; }
        public decimal? OriginalValue { get; set; }
        public decimal? CurrentValue { get; set; }

        public string Description
        {
            get
            {
                if (string.IsNullOrEmpty(OriginalDescription) && string.IsNullOrEmpty(CurrentDescription))
                    return " - ";
                else if (!string.IsNullOrEmpty(OriginalDescription) && string.IsNullOrEmpty(CurrentDescription))
                    return OriginalDescription;
                else if (string.IsNullOrEmpty(OriginalDescription) && !string.IsNullOrEmpty(CurrentDescription))
                    return CurrentDescription;
                else
                    return CurrentDescription;
            }
        }
        public decimal Difference
        {
            get
            {
                if (OriginalValue.HasValue && CurrentValue.HasValue)
                    return CurrentValue.Value - OriginalValue.Value;
                else if (!OriginalValue.HasValue && CurrentValue.HasValue)
                    return - CurrentValue.Value;
                else if (OriginalValue.HasValue && !CurrentValue.HasValue)
                    return OriginalValue.Value;
                else
                    return 0;
            }
        }
    }
}
